package nz.ac.massey.cs.se400_2013.ass3.plugin;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class PaperEditorUi extends BasicEditor{

		private JTextField nameEntry;
		private JLabel nameLabel;
		private JTextField idEntry;
		private JLabel idLabel;
		
		public PaperEditorUi(){
			nameEntry = new JTextField();
			nameLabel = new JLabel("name");
			idEntry = new JTextField();
			idLabel = new JLabel("id");
			GridBagLayout layout = new GridBagLayout();
			this.setLayout(layout);
			this.addName();
			this.addId();
			this.addChangeHandlers();
		}
		
		public void addName(){
			GridBagConstraints constraints = new GridBagConstraints();
			constraints.anchor = GridBagConstraints.SOUTHWEST;
			constraints.gridx = 0;
			constraints.gridy = 0;
			constraints.ipadx = 100;
			this.add(this.nameLabel, constraints);
			
			constraints.gridx = 1;
			constraints.gridy = 0;
			this.add(this.nameEntry, constraints);
		}
		
		public void setId(String text){
			this.idEntry.setText(text);
		}
		
		public String getId(){
			return this.idEntry.getText();
		}
		
		public void setName(String name){
			this.nameEntry.setText(name);
		}
		
		public void addId(){
			GridBagConstraints constraints = new GridBagConstraints();
			constraints.anchor = GridBagConstraints.SOUTHWEST;
			constraints.gridx = 0;
			constraints.gridy = 1;
			constraints.ipadx = 100;
			this.add(this.idLabel, constraints);
			
			constraints.gridx = 1;
			constraints.gridy = 1;
			this.add(this.idEntry, constraints);
		}
		
}

